export const formatDate = function (value, args) {
    if (value) {
        value = value.replace(/-/g, "/");
        var dt = new Date(value);
        var y = dt.getFullYear();
        var m = dt.getMonth() + 1;
        var d = dt.getDate();
        return `${y}-${m}-${d}`;
    }
}

export const formatDateTime = function (value, args) {
    if (value) {
        value = value.replace(/-/g, "/");
        var dt = new Date(value);
        const y = dt.getFullYear()
        const m = (dt.getMonth() + 1 + '').padStart(2, '0')
        const d = (dt.getDate() + '').padStart(2, '0')
        const hh = (dt.getHours() + '').padStart(2, '0')
        const mm = (dt.getMinutes() + '').padStart(2, '0')
        return `${y}-${m}-${d} ${hh}:${mm}`;
    }
}

export const formatMouthTime = function (value, args) {
    if (value) {
        value = value.replace(/-/g, "/");
        var dt = new Date(value);
        const y = dt.getFullYear()
        const m = (dt.getMonth() + 1 + '').padStart(2, '0')
        const d = (dt.getDate() + '').padStart(2, '0')
        const hh = (dt.getHours() + '').padStart(2, '0')
        const mm = (dt.getMinutes() + '').padStart(2, '0')
        return `${m}-${d} ${hh}:${mm}`;
    }
}
export const enterToBr = function (value, args) {
    if (value) {
        value = value.replace(/\n/g, "<br/>");
    }
    return value;
}
